package FuncUser

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func Hello01(context *gin.Context) {
	context.HTML(200, "demo01/index.html", nil)
}

func Hello02(context *gin.Context) {
	username := context.PostForm("username")
	pwd := context.PostForm("pwd")

	var m map[string]string = make(map[string]string, 2)
	m["username"] = username
	m["pwd"] = pwd
	context.HTML(200, "demo01/UserInfo.html", m)

}

func Hello03(context *gin.Context) {
	//获取post-ajax请求的数据，获取对应的参数：
	uname := context.PostForm("uname")

	fmt.Println(uname)
	fmt.Println(uname == "丽丽")

	if uname == "丽丽" {
		/*mapData := map[string]interface{}{
			"msg": "请求的用户名重复",
		}
		context.JSON(200, mapData)*/

		context.JSON(200, gin.H{
			"msg": "请求的用户名重复",
		})
	} else {

		context.JSON(200, gin.H{
			"msg": "",
		})
	}

}
